/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package specifications;

import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.nodes.Tag;

/**
 *
 * @author Jason
 */
public class WorkplaceRequirements extends Parameter implements YamlObject<WorkplaceRequirements> {
    public static final Tag TAG = new Tag("!WorkplaceRequirements");
    private ArrayList<Directive> content;
    
    public WorkplaceRequirements(){}
    public WorkplaceRequirements(ArrayList<Directive> content){
        setPriority(10); //default priority
        this.content = content;}
    
    @Override
    public ArrayList<Directive> getDirectives() {
        return content;
    }

    @Override
    public void dump(String filename) throws IOException {
        Yaml yaml = new Yaml(CONSTRUCTOR, REPRESENTER);
        FileWriter writer = new FileWriter(filename);
        writer.write(yaml.dumpAs(this, TAG, DumperOptions.FlowStyle.BLOCK));
        writer.close();
    }

    @Override
    public WorkplaceRequirements load(String filename) throws IOException {
        Yaml yaml = new Yaml(CONSTRUCTOR, REPRESENTER);
        FileReader reader = new FileReader(filename);
        WorkplaceRequirements param = yaml.loadAs(reader, WorkplaceRequirements.class);
        reader.close();
        return param;
    }


    /**
     * @return the content
     */
    public ArrayList<Directive> getContent() {
        return content;
    }

    /**
     * @param content the content to set
     */
    public void setContent(ArrayList<Directive> content) {
        this.content = content;
    }
    
}
